







function CreateNewAppointmentHelper(iType, oDateTime, bLoadDialog)
{
var strDateParam = "";


var currentTime = LocalDateTimeNow();
if ( currentTime.getMinutes() >= 30 )
{
currentTime.setHours( currentTime.getHours() + 1 , 0, 0, 0 );
}
else
{
currentTime.setMinutes ( 30, 0, 0 );
}

if (!IsNull(oDateTime))
{
var oInitialDateTime = new Date(oDateTime.valueOf());
oInitialDateTime.setHours( currentTime.getHours() );
oInitialDateTime.setMinutes( currentTime.getMinutes() );
strDateParam = '_StartTime=' + CrmEncodeDecode.CrmUrlEncode(FormatUtcDate(oInitialDateTime) );
}

if (!IsNull(bLoadDialog) && bLoadDialog)
{
if (strDateParam!="")
{
strDateParam += "&";
}
strDateParam += "loadDialog=true";
}

openObjEx( iType, null, null, ((strDateParam=="")?"":("?"+strDateParam)));
}
